﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Root.master" AutoEventWireup="true" CodeFile="dogdoc.aspx.cs" Inherits="Default2" %>

<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxFormLayout" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data.Linq" TagPrefix="cc1" %>

<%@ Register Assembly="DevExpress.XtraReports.v12.2.Web, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.XtraReports.Web" TagPrefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Content" runat="Server">
    <script src="../Scripts/toolbar.js" type="text/javascript"></script>
    <script type="text/javascript">
        // <![CDATA[
        var value = null;
        function OnValueChanged(cbb, combo) {
            if (combo.InCallback()) {
                value = cbb.GetValue().toString();
            }
            else {
                combo.PerformCallback(cbb.GetValue().toString());

            }
        }
        function OnEndCallback(combo) {
            if (value) {
                combo.PerformCallback(value);
                value = null;
            }
            else {
                lpanel.Hide();
            }
        }

        function ShowReport() {
            //clBack.PerformCallback('ReportParam');
            //e.processOnServer = true;
            rView.Refresh();
            repWindow.Show();
            
        }

        function ClearCombo(combo) {
            if (combo) {
                combo.ClearItems();
            }
            else {
                cbb_Shelf.ClearItems();
                cbb_Cell.ClearItems();
                cbb_Folder.ClearItems();
            }
        }

        function NewCompl() {
            clBack.PerformCallback('AddNewCompl');
            cbb_ComplDoc.PerformCallback();
            cbb_ComplDoc.SetSelectedIndex(-1);
            btnNewCompl.SetValue(null);
        }

        function SaveDoc(isClose) {
            if (isClose) {
                clBack.PerformCallback('SaveDoc');
                grd_doc.Refresh();
                popInsert.Hide();
            } else {
                clBack.PerformCallback('SaveDoc');
                grd_doc.Refresh();
            }
        }

        function ExecDoc() {
            lpanel.Show();
            clBack.PerformCallback('GetArcCode');
            grd_doc.Refresh();
            lpanel.Hide();
            ppc_replace.Hide();

        }
        function onMenuClick(s, e) {
            switch (e.item.index) {
                case 0:
                    popInsert.Show();
                    break;
                case 4:
                    if (confirm('Вы действительно хотите распределить документы по папкам?')) {
                        clBack.PerformCallback('distributeRec');
                        grd_doc.Refresh();
                        lstArc.PerformCallback();
                        //e.processOnServer = true;                        
                    }
                    break;
                case 5:
                    if (confirm('Вы действительно хотите внести незакрепленные документы в одну папку?')) {
                        clBack.PerformCallback('distributeAllRec');
                        grd_doc.Refresh();
                        lstArc.PerformCallback();
                        
                    }
                    break;
                case 6:
                    if (confirm('Вы действительно хотите очистить распределение по папкам?')) {
                        clBack.PerformCallback('ClearAll');
                        grd_doc.Refresh();
                        lstArc.PerformCallback();
                        //e.processOnServer = true;
                    }
                    break;
                case 7:
                    if (confirm('Вы действительно хотите создать документ внутреннего перемещения?')) {
                        clBack.PerformCallback('CreateMoveDoc');
                        grd_doc.Refresh();
                    }
                    break;

                default: MenuItemClick(e, grd_doc);
            }
        }
        // ]]> 
    </script>
    <div class="pageLabel">
        <dx:ASPxLabel ID="lbl_page" runat="server" Text="Список документов к договору" Font-Size="Medium" Theme="iOS">
        </dx:ASPxLabel>
    </div>
    <div style="float: left; margin-left: 10px;">

        <asp:EntityDataSource ID="ds_ArcPlace" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar"
            EnableFlattening="False" EntitySetName="ARCPLACE" OrderBy="it.SHELF, it.CELL, it.NUMBER">
        </asp:EntityDataSource>
        <dx:ASPxFormLayout ID="flt_pop" runat="server" ColCount="2">
            <Items>
                <dx:LayoutGroup Caption="Список документов к договору">
                    <Items>
                        <dx:LayoutItem Caption="Layout Item" ShowCaption="False">
                            <LayoutItemNestedControlCollection>
                                <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                    <dx:ASPxMenu ID="mMenu" runat="server" EnableViewState="False" EncodeHtml="False" SeparatorWidth="2px" BackColor="Transparent"
                                        SeparatorHeight="15px" ItemSpacing="1px">
                                        <SeparatorBackgroundImage ImageUrl="~\Images\shared\ToolBars\Office2003\SeparatorBackground.png" />
                                        <ClientSideEvents ItemClick="function(s, e) { onMenuClick(s, e);}" />
                                        <Items>
                                            <dx:MenuItem Name="btn_Insert" Text="" ToolTip="Добавить запись" GroupName="grp_edit" BeginGroup="True">
                                                <Image Url="~/Images/shared/edit_add.png">
                                                </Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem GroupName="grp_edit" Name="btn_edit" Text="" ToolTip="Редактировать запись">
                                                <Image Url="~/Images/shared/edit.png">
                                                </Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem GroupName="grp_edit" Name="btn_Delete" Text="" ToolTip="Удалит запись">
                                                <Image Url="~/Images/shared/editdelete.png">
                                                </Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem GroupName="grp_settings" Name="btn_column" Text="" ToolTip="Настройка колонок">
                                                <Image Url="~/Images/shared/group.png">
                                                </Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem Text="" Name="distributeRec" ToolTip="Распределить документы по папкам">
                                                <Image Url="~/Images/shared/apply.png">
                                                </Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem Name="distributeAllRec" Text="" ToolTip="Внести незакрепленные документы в одну папку">
                                                <Image ToolTip="Внести незакрепленные документы в одну папку" Url="~/Images/shared/BaseList.png">
                                                </Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem Name="btnClear" Text="" ToolTip="Удалить привязку к папкам">
                                                <Image Url="~/Images/shared/unapply.png" ToolTip="Удалить привязку к папкам">
                                                </Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem Text="">
                                                <Image ToolTip="Создать внутренее перемещение" Url="~/Images/shared/format-justify-fill.png">
                                                </Image>
                                            </dx:MenuItem>
                                        </Items>
                                    </dx:ASPxMenu>
                                    <dx:ASPxGridView ID="grd_doc" ClientInstanceName="grd_doc" runat="server" AutoGenerateColumns="False" DataSourceID="ds_dogdoc" KeyFieldName="CODE" OnRowInserting="grd_doc_RowInserting" OnRowUpdating="grd_doc_RowUpdating" OnRowDeleted="grd_doc_RowDeleted" OnCustomUnboundColumnData="grd_doc_CustomUnboundColumnData" OnRowInserted="grd_doc_RowInserted" KeyboardSupport="True">
                                        <Columns>
                                            <dx:GridViewDataTextColumn FieldName="CODE" ReadOnly="True" ShowInCustomizationForm="True" VisibleIndex="1" Caption="Код" Visible="False">
                                                <EditFormSettings Visible="False" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn FieldName="DOPDOG" ShowInCustomizationForm="False" VisibleIndex="2" Visible="False">
                                                <EditFormSettings Visible="False" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataComboBoxColumn Caption="Тип докуметна" FieldName="DOCTYPE" ShowInCustomizationForm="True" VisibleIndex="3" Width="100px">
                                                <PropertiesComboBox DataSourceID="ds_DocType" TextField="NAME" ValueField="CODE" ValueType="System.Int32" Width="150px">
                                                </PropertiesComboBox>
                                                <EditFormSettings VisibleIndex="0" />
                                            </dx:GridViewDataComboBoxColumn>
                                            <dx:GridViewDataTextColumn FieldName="NOMER" ShowInCustomizationForm="True" VisibleIndex="4" Caption="Номер документа" Width="80px">
                                                <PropertiesTextEdit Width="100px">
                                                </PropertiesTextEdit>
                                                <EditFormSettings VisibleIndex="1" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataDateColumn FieldName="DATA" ShowInCustomizationForm="True" VisibleIndex="5" Caption="Дата документа" Width="80px">
                                                <EditFormSettings VisibleIndex="2" />
                                            </dx:GridViewDataDateColumn>
                                            <dx:GridViewDataTextColumn FieldName="PAGENUM" ShowInCustomizationForm="True" VisibleIndex="6" Caption="Кол-во страниц" Width="80px">
                                                <EditFormSettings VisibleIndex="3" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn FieldName="NOTE" ShowInCustomizationForm="True" VisibleIndex="10" Caption="Примечание">
                                                <EditFormSettings ColumnSpan="2" VisibleIndex="6" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataComboBoxColumn Caption="Папка" FieldName="ARCPLACE" ShowInCustomizationForm="True" VisibleIndex="7" Width="80px">
                                                <PropertiesComboBox DataSourceID="ds_ArcPlace" EnableFocusedStyle="False" TextField="STRCODE" ValueField="CODE" ValueType="System.Int32">
                                                </PropertiesComboBox>
                                                <EditFormSettings Visible="False" VisibleIndex="4" />
                                            </dx:GridViewDataComboBoxColumn>
                                            <dx:GridViewDataComboBoxColumn Caption="Статус" FieldName="STATE" ShowInCustomizationForm="True" VisibleIndex="8" Width="80px">
                                                <PropertiesComboBox>
                                                    <Items>
                                                        <dx:ListEditItem Text="изъят" Value="0" />
                                                        <dx:ListEditItem Text="на хранении" Value="1" />
                                                    </Items>
                                                </PropertiesComboBox>
                                                <EditFormSettings VisibleIndex="5" Visible="False" />
                                            </dx:GridViewDataComboBoxColumn>
                                            <dx:GridViewCommandColumn ShowInCustomizationForm="True" ShowSelectCheckbox="True" VisibleIndex="0">
                                                <ClearFilterButton Visible="True">
                                                </ClearFilterButton>
                                            </dx:GridViewCommandColumn>
                                            <dx:GridViewDataTextColumn ShowInCustomizationForm="True" VisibleIndex="11">
                                                <EditFormSettings Visible="False" />
                                                <DataItemTemplate>
                                                    <a href="docscan.aspx?dscod=<%# Eval("CODE") %>" style="color: #000000" target="_blank">сканкопии</a>
                                                </DataItemTemplate>
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataComboBoxColumn Caption="Описание типа" FieldName="COMPLECTDOC" ShowInCustomizationForm="True" VisibleIndex="9" Width="150px">
                                                <PropertiesComboBox DataSourceID="dsCompletDoc" TextField="NAME" ValueField="CODE" ValueType="System.Int32">
                                                </PropertiesComboBox>
                                            </dx:GridViewDataComboBoxColumn>
                                        </Columns>
                                        <SettingsEditing Mode="PopupEditForm" />
                                        <SettingsBehavior AllowFocusedRow="True" ConfirmDelete="True" EnableCustomizationWindow="true" AllowSelectByRowClick="True" AllowSelectSingleRowOnly="True" />
                                        <SettingsPager AlwaysShowPager="True">
                                            <PageSizeItemSettings Visible="True">
                                            </PageSizeItemSettings>
                                        </SettingsPager>

                                        <Settings ShowFilterRow="True" ShowFooter="True" />
                                        <SettingsCookies CookiesID="grd_docCh" Enabled="True" StoreColumnsVisiblePosition="False" StoreColumnsWidth="False" StoreFiltering="False" StoreGroupingAndSorting="False" />
                                    </dx:ASPxGridView>
                                    <dx:ASPxButton ID="btn_replace" runat="server" AutoPostBack="False" Text="Распределить документы" Theme="iOS" Width="100%" Visible="False">
                                        <ClientSideEvents Click="function(s, e) {ppc_replace.Show();}" />
                                    </dx:ASPxButton>
                                </dx:LayoutItemNestedControlContainer>
                            </LayoutItemNestedControlCollection>
                        </dx:LayoutItem>
                    </Items>
                </dx:LayoutGroup>
                <dx:LayoutGroup Caption="Список типов документов ">
                    <Items>
                        <dx:LayoutItem Caption="Layout Item" ShowCaption="False">
                            <LayoutItemNestedControlCollection>
                                <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                    <dx:ASPxMenu ID="ASPxMenu1" runat="server" EnableViewState="False" EncodeHtml="False" SeparatorWidth="2px" BackColor="Transparent"
                                        SeparatorHeight="15px" ItemSpacing="1px">
                                        <SeparatorBackgroundImage ImageUrl="~\Images\shared\ToolBars\Office2003\SeparatorBackground.png" />
                                        <ClientSideEvents ItemClick="function(s, e) { MenuItemClick(e, grd_DocType); }" />
                                        <Items>
                                            <dx:MenuItem Name="btn_Insert" Text="" ToolTip="Добавить запись" GroupName="grp_edit" BeginGroup="True">
                                                <Image Url="~/Images/shared/edit_add.png">
                                                </Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem GroupName="grp_edit" Name="btn_edit" Text="" ToolTip="Редактировать запись">
                                                <Image Url="~/Images/shared/edit.png">
                                                </Image>
                                            </dx:MenuItem>
                                            <dx:MenuItem GroupName="grp_edit" Name="btn_Delete" Text="" ToolTip="Удалит запись">
                                                <Image Url="~/Images/shared/editdelete.png">
                                                </Image>
                                            </dx:MenuItem>
                                        </Items>
                                    </dx:ASPxMenu>
                                    <dx:ASPxGridView ID="grd_DocType" ClientInstanceName="grd_DocType" runat="server" AutoGenerateColumns="False"
                                        DataSourceID="ds_DocType" KeyFieldName="CODE" OnRowInserting="grd_DocType_RowInserting" Width="200px">
                                        <Columns>
                                            <dx:GridViewDataTextColumn FieldName="CODE" ReadOnly="True" ShowInCustomizationForm="True" VisibleIndex="0">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn FieldName="NAME" ShowInCustomizationForm="True" VisibleIndex="1">
                                            </dx:GridViewDataTextColumn>
                                        </Columns>
                                        <Settings ShowColumnHeaders="False" />
                                        <SettingsBehavior AllowFocusedRow="True" ConfirmDelete="True" EnableCustomizationWindow="true" AllowSelectByRowClick="True" AllowSelectSingleRowOnly="True" />
                                        <SettingsEditing EditFormColumnCount="1" />
                                    </dx:ASPxGridView>
                                    <br />
                                    <div title="Список папок" align="center">
                                        Спсиок папок
                                       <dx:ASPxListBox ID="lstArc" ClientInstanceName="lstArc" runat="server" Width="100%" OnCallback="lstArc_Callback">
                                       </dx:ASPxListBox>
                                        <dx:ASPxButton ID="ASPxButton1" runat="server" Text="Печать" AutoPostBack="False">
                                            <ClientSideEvents Click="function(s, e) {ShowReport();}" />
                                        </dx:ASPxButton>
                                    </div>
                                </dx:LayoutItemNestedControlContainer>
                            </LayoutItemNestedControlCollection>
                        </dx:LayoutItem>
                    </Items>
                </dx:LayoutGroup>
            </Items>
        </dx:ASPxFormLayout>
    </div>
    <dx:ASPxPopupControl ID="ppc_replace" ClientInstanceName="ppc_replace" runat="server" Height="139px" Width="249px"
        AllowDragging="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" Modal="True"
        CloseAction="CloseButton" EnableViewState="False" HeaderText="Распределение документов" ShowFooter="True" Theme="Office2010Black">
        <HeaderStyle HorizontalAlign="Center" />
        <FooterTemplate>
            <div align="right">
                <dx:ASPxButton ID="btn_Exec" ClientInstanceName="btn_Exec" runat="server" AutoPostBack="false" Text="Выполнить"
                    ValidateRequestMode="Enabled" ValidationGroup="arh" OnClick="btn_Exec_Click">
                </dx:ASPxButton>
            </div>
        </FooterTemplate>
        <ContentCollection>
            <dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
                <dx:ASPxFormLayout ID="flt" runat="server">
                    <Items>
                        <dx:LayoutItem Caption="Листов в папке">
                            <LayoutItemNestedControlCollection>
                                <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                    <dx:ASPxSpinEdit ID="spn_cnt" runat="server" Height="21px" Number="200" Width="155px" EnableViewState="False">
                                        <ValidationSettings>
                                            <RequiredField IsRequired="True" />
                                        </ValidationSettings>
                                    </dx:ASPxSpinEdit>
                                    <br />
                                    <dx:ASPxCheckBox ID="checkAll" runat="server" CheckState="Unchecked" Text="Все в одну папку" TextAlign="Right" Width="150px">
                                    </dx:ASPxCheckBox>
                                </dx:LayoutItemNestedControlContainer>
                            </LayoutItemNestedControlCollection>
                        </dx:LayoutItem>
                        <%--                        <dx:LayoutItem Caption="Папка">
                            <LayoutItemNestedControlCollection>
                                <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                    <dx:ASPxComboBox ID="cbb_object" runat="server" DataSourceID="ds_ARCOBJECT" 
                                        TextField="STRCODE" ValueField="CODE" AutoResizeWithContainer="true" ValueType="System.Int32" ValidateRequestMode="Enabled" DropDownStyle="DropDown" EnableCallbackMode="True" EnableIncrementalFiltering="True" IncrementalFilteringMode="StartsWith" Width="155px" EnableViewState="False">
                                        <ValidationSettings>
                                            <RequiredField IsRequired="True" />
                                        </ValidationSettings>
                                    </dx:ASPxComboBox>
                                    <asp:EntityDataSource ID="ds_ARCOBJECT" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableFlattening="False" EntitySetName="ARCPLACE" AutoGenerateWhereClause="True" Select="it.[CODE], it.[STRCODE]" Where="">
                                        <WhereParameters>
                                            <asp:Parameter DbType="Int16" DefaultValue="0" Name="STATE" />
                                        </WhereParameters>
                                    </asp:EntityDataSource>
                                </dx:LayoutItemNestedControlContainer>
                            </LayoutItemNestedControlCollection>
                        </dx:LayoutItem>--%>
                    </Items>
                    <SettingsItemCaptions HorizontalAlign="Left" />
                </dx:ASPxFormLayout>
                <dx:ASPxLoadingPanel ID="lpanel" runat="server" ClientInstanceName="lpanel" Theme="BlackGlass">
                </dx:ASPxLoadingPanel>
                <dx:ASPxCallback ID="clBack" ClientInstanceName="clBack" runat="server" OnCallback="clBack_Callback">
                </dx:ASPxCallback>
            </dx:PopupControlContentControl>
        </ContentCollection>
    </dx:ASPxPopupControl>
    <dx:ASPxPopupControl ID="popInsert" ClientInstanceName="popInsert" runat="server" ShowFooter="True" Theme="Metropolis" HeaderText="Форма редактирования"
        PopupHorizontalAlign="WindowCenter"
        PopupVerticalAlign="WindowCenter"
        AllowDragging="True">
        <FooterStyle HorizontalAlign="Right" />
        <FooterTemplate>
            <table align="right">
                <tr>
                    <td>
                        <dx:ASPxHyperLink ID="linkSave" runat="server" NavigateUrl="#" Text="Сохранить">
                            <ClientSideEvents Click="function(s, e) {SaveDoc(false);}" />
                        </dx:ASPxHyperLink>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td>
                        <dx:ASPxHyperLink ID="linkCloseSave" runat="server" NavigateUrl="#" Text="Сохранить и закрыть">
                            <ClientSideEvents Click="function(s, e) {SaveDoc(true);}" />
                        </dx:ASPxHyperLink>
                    </td>
                    <td></td>
                </tr>
            </table>


        </FooterTemplate>
        <ContentCollection>
            <dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
                <dx:ASPxFormLayout ID="ASPxFormLayout1" runat="server">
                    <Items>
                        <dx:LayoutGroup Caption="Layout Group" ShowCaption="False">
                            <Items>
                                <dx:LayoutItem Caption="Тип документа">
                                    <LayoutItemNestedControlCollection>
                                        <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                            <dx:ASPxComboBox ID="cbb_DocType" runat="server" DataSourceID="ds_DocType" TextField="NAME" ValueField="CODE" ValueType="System.Int32" IncrementalFilteringMode="Contains">
                                                <ValidationSettings Display="Dynamic" ErrorDisplayMode="ImageWithTooltip">
                                                    <RequiredField IsRequired="True" />
                                                </ValidationSettings>
                                            </dx:ASPxComboBox>
                                        </dx:LayoutItemNestedControlContainer>
                                    </LayoutItemNestedControlCollection>
                                </dx:LayoutItem>
                                <dx:LayoutItem Caption="Номер документа">
                                    <LayoutItemNestedControlCollection>
                                        <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                            <dx:ASPxTextBox ID="txt_DocNum" runat="server" Width="170px">
                                                <ValidationSettings Display="Dynamic" ErrorDisplayMode="ImageWithTooltip">
                                                    <RequiredField IsRequired="True" />
                                                </ValidationSettings>
                                            </dx:ASPxTextBox>
                                        </dx:LayoutItemNestedControlContainer>
                                    </LayoutItemNestedControlCollection>
                                </dx:LayoutItem>
                                <dx:LayoutItem Caption="Дата документа">
                                    <LayoutItemNestedControlCollection>
                                        <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                            <dx:ASPxDateEdit ID="dt_DateDoc" runat="server">
                                                <ValidationSettings Display="Dynamic" ErrorDisplayMode="ImageWithTooltip">
                                                    <RequiredField IsRequired="True" />
                                                </ValidationSettings>
                                            </dx:ASPxDateEdit>
                                        </dx:LayoutItemNestedControlContainer>
                                    </LayoutItemNestedControlCollection>
                                </dx:LayoutItem>
                                <dx:LayoutItem Caption="Кол-во страниц">
                                    <LayoutItemNestedControlCollection>
                                        <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                            <dx:ASPxSpinEdit ID="spn_Kol" runat="server" Height="21px" Number="0">
                                                <ValidationSettings Display="Dynamic" ErrorDisplayMode="ImageWithTooltip">
                                                    <RequiredField IsRequired="True" />
                                                </ValidationSettings>
                                            </dx:ASPxSpinEdit>
                                        </dx:LayoutItemNestedControlContainer>
                                    </LayoutItemNestedControlCollection>
                                </dx:LayoutItem>
                            </Items>
                        </dx:LayoutGroup>
                        <dx:LayoutItem Caption="Примечание" Width="100%">
                            <LayoutItemNestedControlCollection>
                                <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                    <dx:ASPxTextBox ID="txt_Note" runat="server" Width="100%">
                                    </dx:ASPxTextBox>
                                </dx:LayoutItemNestedControlContainer>
                            </LayoutItemNestedControlCollection>
                        </dx:LayoutItem>
                        <dx:LayoutGroup Caption="Layout Group" ShowCaption="False">
                            <Items>
                                <dx:LayoutItem Caption="Описание типа">
                                    <LayoutItemNestedControlCollection>
                                        <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                            <dx:ASPxComboBox ID="cbb_ComplDoc" ClientInstanceName="cbb_ComplDoc" runat="server" DataSourceID="dsCompletDoc" IncrementalFilteringMode="Contains" TextField="NAME" ValueField="CODE" ValueType="System.Int32" OnCallback="cbb_ComplDoc_Callback">
                                                <ValidationSettings Display="Dynamic" ErrorDisplayMode="ImageWithTooltip">
                                                    <RequiredField IsRequired="True" />
                                                </ValidationSettings>
                                            </dx:ASPxComboBox>
                                        </dx:LayoutItemNestedControlContainer>
                                    </LayoutItemNestedControlCollection>
                                </dx:LayoutItem>
                                <dx:LayoutItem Caption="Добавить описание типа">
                                    <LayoutItemNestedControlCollection>
                                        <dx:LayoutItemNestedControlContainer runat="server" SupportsDisabledAttribute="True">
                                            <dx:ASPxButtonEdit ID="btn_NewCompl" ClientInstanceName="btnNewCompl" runat="server">
                                                <ClientSideEvents ButtonClick="NewCompl" />
                                                <Buttons>
                                                    <dx:EditButton ToolTip="Создать новое описание типа">
                                                        <Image Url="~/Images/shared/edit_add.png">
                                                        </Image>
                                                    </dx:EditButton>
                                                </Buttons>
                                            </dx:ASPxButtonEdit>
                                        </dx:LayoutItemNestedControlContainer>
                                    </LayoutItemNestedControlCollection>
                                </dx:LayoutItem>
                            </Items>
                        </dx:LayoutGroup>
                    </Items>
                </dx:ASPxFormLayout>
            </dx:PopupControlContentControl>
        </ContentCollection>
    </dx:ASPxPopupControl>

    <dx:ASPxPopupControl ID="repWindow" ClientInstanceName="repWindow" runat="server" Height="500px" Width="700px" Modal="True"
        PopupHorizontalAlign="WindowCenter"
        PopupVerticalAlign="WindowCenter"
        AllowDragging="True" HeaderText="" CloseAction="CloseButton" Target="_blank">
        <ContentCollection>
            <dx:PopupControlContentControl runat="server" SupportsDisabledAttribute="True">
                <dx:ReportToolbar ID="ReportToolbar1" runat="server" ReportViewerID="rView" ShowDefaultButtons="False">
                    <Items>
                        <dx:ReportToolbarButton ItemKind="Search" />
                        <dx:ReportToolbarSeparator />
                        <dx:ReportToolbarButton ItemKind="PrintReport" />
                        <dx:ReportToolbarButton ItemKind="PrintPage" />
                        <dx:ReportToolbarSeparator />
                        <dx:ReportToolbarButton Enabled="False" ItemKind="FirstPage" />
                        <dx:ReportToolbarButton Enabled="False" ItemKind="PreviousPage" />
                        <dx:ReportToolbarLabel ItemKind="PageLabel" />
                        <dx:ReportToolbarComboBox ItemKind="PageNumber" Width="65px">
                        </dx:ReportToolbarComboBox>
                        <dx:ReportToolbarLabel ItemKind="OfLabel" />
                        <dx:ReportToolbarTextBox IsReadOnly="True" ItemKind="PageCount" />
                        <dx:ReportToolbarButton ItemKind="NextPage" />
                        <dx:ReportToolbarButton ItemKind="LastPage" />
                        <dx:ReportToolbarSeparator />
                        <dx:ReportToolbarButton ItemKind="SaveToDisk" />
                        <dx:ReportToolbarButton ItemKind="SaveToWindow" />
                        <dx:ReportToolbarComboBox ItemKind="SaveFormat" Width="70px">
                            <Elements>
                                <dx:ListElement Value="pdf" />
                                <dx:ListElement Value="xls" />
                                <dx:ListElement Value="xlsx" />
                                <dx:ListElement Value="rtf" />
                                <dx:ListElement Value="mht" />
                                <dx:ListElement Value="html" />
                                <dx:ListElement Value="txt" />
                                <dx:ListElement Value="csv" />
                                <dx:ListElement Value="png" />
                            </Elements>
                        </dx:ReportToolbarComboBox>
                    </Items>
                    <Styles>
                        <LabelStyle>
                        <Margins MarginLeft="3px" MarginRight="3px" />
                        </LabelStyle>
                    </Styles>
                </dx:ReportToolbar>
                <dx:ReportViewer ID="rView" ClientInstanceName="rView" runat="server" Report="<%# new DogDocRep() %>" ReportName="DogDocRep" OnLoad="rView_Load" OnUnload="rView_Unload">
                </dx:ReportViewer>
            </dx:PopupControlContentControl>
        </ContentCollection>

    </dx:ASPxPopupControl>
    <asp:EntityDataSource ID="ds_dogdoc" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="DOGDOC" AutoGenerateWhereClause="True" Where="">
        <WhereParameters>
            <asp:QueryStringParameter DbType="Int32" DefaultValue="0" Name="DOPDOG" QueryStringField="dcod" />
        </WhereParameters>
    </asp:EntityDataSource>

    <asp:EntityDataSource runat="server" DefaultContainerName="RegistRar" ConnectionString="name=RegistRar" EnableFlattening="False" EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntitySetName="DOCTYPE" ID="ds_DocType"></asp:EntityDataSource>
    <asp:EntityDataSource ID="dsCompletDoc" runat="server" ConnectionString="name=RegistRar" DefaultContainerName="RegistRar" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="COMPLECTDOC">
    </asp:EntityDataSource>
    <asp:SqlDataSource ID="ds_CLEARARCPLACE" runat="server" ConnectionString="<%$ ConnectionStrings:RegRar %>" ProviderName="<%$ ConnectionStrings:RegRar.ProviderName %>" SelectCommand="CLEARARCPLACE" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter DbType="Int32" DefaultValue="-1" Name="DOGDOP" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>

